package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JsonUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 攻略分类
 */
@Setter
@Getter
public class StrategyCatalog extends BaseDomain{

    //攻略分类名称
    private String name;

    //攻略id
    private Strategy strategy;

    //序号
    private Integer sequence;

    //状态
    private Boolean state;

    //文章
    private List<StrategyDetail> details ;

    public String getJson(){
        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("sequence",sequence);
        map.put("state",state);
        if (strategy != null){
            map.put("strategyId",strategy.getId());
            map.put("strategyTitle",strategy.getTitle());
        }
        return JsonUtil.toJsonString(map);
    }
}